<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <title>联系人列表</title>
    <link rel="stylesheet" type="text/css" href="${path}/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="${path}/css/public.css"/>

    <link rel="stylesheet" href="${path}/css/themes/base/jquery.ui.all.css">
    <script src="${path}/js/jquery-1.7.2.js"></script>
    <script src="${path}/js/jquery.ui.core.js"></script>
    <script src="${path}/js/jquery.ui.widget.js"></script>
    <script src="${path}/js/jquery.ui.button.js"></script>
    <link rel="stylesheet" href="${path}/css/demos.css">

    <link rel="stylesheet" href="${path}/css/icons.css">

    <script src="${path}/js/icons.js"></script>

    <style type="text/css">
        .mytable {
            margin-top: 20px;
        }

        .mytable td {
            text-align: center;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#btnClose").click(function () {
                window.close();
            });
            $("#btnConfirm").click(function () {

                var parentInput = dialogArguments;
                //TODO...设置隐藏域 owner ids
                var id = "";
                for (var i = 0; i < $(".radios").length; i++) {
                    if ($(".radios")[i].checked == true) {
                        id += $(".radios")[i].value;
                    }
                }
                $("#ownerId").val(id);
                $("#dispatchForm").submit();
                window.close();
            });

        });
    </script>
</head>
<body>

<div class="pageBody">

    <form id="dispatchForm" name="dispatchForm" action="${path}/customer/dispatch.do" method="post">
        <input type="hidden" name="customers" value="${customersId}" id="dispatchForm_customers"/>
        <input type="hidden" name="id" value="" id="ownerId"/>
    </form>
    <div class="buttonBar">
        <button id="btnConfirm">确定</button>
        <button id="btnClose">关闭</button>
    </div>
    <table class="mytable">
        <c:if test="${ !empty users}">
            <c:forEach items="${users}" var="u">
                <tr>
                    <td>
                        <input type="radio" class="radios" name="owner"
                               value="${u.id}"></td>
                    <td>${u.realName}</td>
                </tr>
            </c:forEach>
        </c:if>
    </table>
</div>
</body>
</html>